/*
  Copyright 2007 Anders Båtstrand

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.

 */

package org.dyndns.anderlin.jmplayer.client.ui.wizard;

import org.dyndns.anderlin.jmplayer.model.Piece;
import org.dyndns.anderlin.jmplayer.service.ArtistService;
import org.dyndns.anderlin.jmplayer.service.GenericService;
import org.dyndns.anderlin.jmplayer.client.ui.wizard.GenericWizard;
import org.dyndns.anderlin.jmplayer.client.ui.PieceForm;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.richclient.application.event.LifecycleApplicationEvent;
import org.springframework.richclient.command.ActionCommandExecutor;
import org.springframework.richclient.form.CompoundForm;
import org.springframework.richclient.form.FormModelHelper;
import org.springframework.richclient.wizard.AbstractWizard;
import org.springframework.richclient.wizard.FormBackedWizardPage;
import org.springframework.richclient.wizard.WizardDialog;
import org.springframework.util.Assert;

/**
 * New Piece Wizard
 */
public class NewPieceWizard extends GenericWizard<Piece> {

    private ArtistService artistService;

     public NewPieceWizard() {
        super("newPieceWizard");
    }

    public void addPages() {
        CompoundForm wizardForm = getWizardForm();
        addPage(new FormBackedWizardPage(new PieceForm(artistService, FormModelHelper.createChildPageFormModel(wizardForm.getFormModel()))));
    }

    protected Piece getObject() {
        return new Piece();
    }

    @Required
    public void setArtistService(ArtistService artistService) {
        this.artistService = artistService;
    }
}